package me.sdevil507.org.repository;

import me.sdevil507.org.po.OrgUserRelPo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;

/**
 * 机构用户关系dao
 *
 * @author sdevil507
 * created on 2020/7/14
 */
public interface OrgUserRelRepository extends JpaRepository<OrgUserRelPo, Long>, JpaSpecificationExecutor<OrgUserRelPo>, QuerydslPredicateExecutor<OrgUserRelPo> {

    @Query(nativeQuery = true, value = "SELECT count(b.id) FROM biz_org_user_rel b  where b.user_id =?1 and b.mgr = 1")
    long findIsExsitRole(Long id);

}
